package com.jiantong.work.enums;

/**
 * Created by niufei on 2017/3/28.
 *
 */
public enum Unit {
    TOU(1,"头"),
    ZHI(2,"只"),
    YU(3,"羽"),
    G(4,"克"),
    ML(5,"毫升"),
    TOU_FEN(6,"头份"),
    KG(7,"公斤或Kg");

    private final Integer value;
    private final String description;

    Unit(Integer value, String description) {
        this.value = value;
        this.description = description;
    }

    public static Unit from(Integer value) {
        for (Unit unit : Unit.values()) {
            if (unit.value.equals(value)) {
                return unit;
            }
        }
        return null;
    }

    public Integer value() {
        return this.value;
    }

    @Override
    public String toString() {
        return description;
    }
}
